home *** CD-ROM | disk | FTP | other *** search
/ Dragon Blade - Wrath of Fire (USA) (Press Kit) / Dragon Blade - Wrath of Fire (USA) (Press Kit).bin / pc / main.swf / scripts / DefineSprite_172 / frame_1 / DoAction.as
Encoding:
Text File  |  2007-01-01  |  3.5 KB  |  141 lines

  1. function checkFlvfunct()
  2. {
  3.    if(ns.bytesLoaded != ns.bytesTotal)
  4.    {
  5.       trace("loading");
  6.       amountLoaded = ns.bytesLoaded / ns.bytesTotal;
  7.       newWidth = Math.round(amountLoaded * loader_mc.scrubArea_mc._width);
  8.       loader_mc.loadBar_mc.tween("_width",newWidth,1,"easeInOutSine");
  9.    }
  10.    else
  11.    {
  12.       clearInterval(checkFlvLoad);
  13.       loader_mc.loadBar_mc.tween("_width",loader_mc.scrubArea_mc._width,0.7,"easeOutSine");
  14.       loader_mc.loadBar_mc.alphaTo(0,0.4,"easeOutQuad",1);
  15.    }
  16. }
  17. function videoStatus()
  18. {
  19.    time_var = Math.round(ns.time);
  20.    loader_mc.scrub_mc._x = Math.round(time_var / dur_var * bar_width);
  21. }
  22. function scrubIt()
  23. {
  24.    ns.seek(Math.round(loader_mc.scrub_mc._x / bar_width * dur_var));
  25. }
  26. function checkTime(ns)
  27. {
  28.    var _loc4_ = Math.round(ns.time);
  29.    var _loc6_ = Math.floor(_loc4_ / 60);
  30.    var _loc1_ = Math.floor(_loc4_ % 60);
  31.    if(_loc1_ < 10)
  32.    {
  33.       _loc1_ = "0" + _loc1_;
  34.    }
  35.    var _loc3_ = dur_var;
  36.    var _loc5_ = Math.floor(_loc3_ / 60);
  37.    var _loc2_ = Math.floor(_loc3_ % 60);
  38.    if(_loc2_ < 10)
  39.    {
  40.       _loc2_ = "0" + _loc2_;
  41.    }
  42.    existingTime_txt.text = _loc6_ + ":" + _loc1_;
  43.    totalTime_txt.text = _loc5_ + ":" + _loc2_;
  44. }
  45. var nc = new NetConnection();
  46. nc.connect(null);
  47. var ns = new NetStream(nc);
  48. var amountLoaded;
  49. var dur_var;
  50. var scrubInterval;
  51. var fileNm = _root.loadPreview;
  52. var bar_width = loader_mc.scrubArea_mc._width - loader_mc.scrub_mc._width;
  53. var is_playing = true;
  54. loader_mc.loadBar_mc._width = 0;
  55. theVideo.attachVideo(ns);
  56. ns.onMetaData = function(infoObject)
  57. {
  58.    dur_var = infoObject.duration;
  59.    time_var = Math.round(ns.time);
  60. };
  61. ns.onStatus = function(infoObject)
  62. {
  63.    time_var = Math.round(ns.time);
  64. };
  65. ns.play(fileNm);
  66. trace(fileNm);
  67. checkFlvLoad = setInterval(checkFlvfunct,1000);
  68. var videoInterval = setInterval(videoStatus,100);
  69. rewindHit_mc.useHandCursor = false;
  70. rewindHit_mc.onRollOver = function()
  71. {
  72.    rewindOver_mc.colorTo(16777215,0.2,"easeInSine");
  73. };
  74. rewindHit_mc.onRollOut = function()
  75. {
  76.    rewindOver_mc.colorTo(0,0.5,"easeOutSine");
  77. };
  78. rewindHit_mc.onRelease = function()
  79. {
  80.    ns.seek(0);
  81. };
  82. playHit_mc.useHandCursor = false;
  83. playHit_mc.onRollOver = function()
  84. {
  85.    playOver_mc.colorTo(16777215,0.2,"easeInSine");
  86. };
  87. playHit_mc.onRollOut = function()
  88. {
  89.    playOver_mc.colorTo(0,0.5,"easeOutSine");
  90. };
  91. playHit_mc.onRelease = function()
  92. {
  93.    ns.pause();
  94.    if(is_playing)
  95.    {
  96.       playPause_txt.text = "J";
  97.       is_playing = false;
  98.    }
  99.    else
  100.    {
  101.       playPause_txt.text = "G";
  102.       is_playing = true;
  103.    }
  104. };
  105. loader_mc.scrub_mc.useHandCursor = false;
  106. loader_mc.scrub_mc.onPress = function()
  107. {
  108.    if(is_playing)
  109.    {
  110.       playPause_txt.text = "G";
  111.       ns.pause();
  112.    }
  113.    else
  114.    {
  115.       playPause_txt.text = "J";
  116.    }
  117.    playOver_mc.colorTo(16777215,0.5,"easeOutSine");
  118.    clearInterval(videoInterval);
  119.    scrubInterval = setInterval(scrubIt,10);
  120.    this.startDrag(false,0,this._y,Math.round(loader_mc.loadBar_mc._width - this._width),this._y);
  121. };
  122. loader_mc.scrub_mc.onRelease = loader_mc.scrub_mc.onReleaseOutside = function()
  123. {
  124.    this.stopDrag();
  125.    newPos = Math.round(loader_mc.scrub_mc._x / bar_width * dur_var);
  126.    ns.seek(newPos);
  127.    if(is_playing)
  128.    {
  129.       playPause_txt.text = "G";
  130.       ns.pause();
  131.    }
  132.    else
  133.    {
  134.       playPause_txt.text = "J";
  135.    }
  136.    playOver_mc.colorTo(0,0.5,"easeOutSine");
  137.    clearInterval(scrubInterval);
  138.    videoInterval = setInterval(videoStatus,100);
  139. };
  140. var time_interval = setInterval(checkTime,500,ns);
  141.